﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace QuanLyDuocPham.View.QuanLyHeThong.DanhMuc
{
    /// <summary>
    /// Interaction logic for HOATCHAT_Add_View.xaml
    /// </summary>
    public partial class HOATCHAT_Add_View : Window
    {
        public HOATCHAT_Add_View()
        {
            InitializeComponent();
        }
        public delegate void added();
        public added done;
        string ma_hc;
        public string _ma_hc
        {
            set
            {
                ma_hc = value;
            }
        }
        Controllers.QuanLyHeThong.DanhMuc.HOATCHAT_Control hoatchatctrl = new Controllers.QuanLyHeThong.DanhMuc.HOATCHAT_Control();
        private void btBack_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void btOk_Click(object sender, RoutedEventArgs e)
        {
            hoatchatctrl.addData(ma_hc, txtTenHoatChat, chbTheo_Toa, txtGhi_Chu, txtMoTa);

            if (done != null)
            {
                done();
            }
            ma_hc=hoatchatctrl.loadID_moi();
            txtTenHoatChat.Clear();
            txtMoTa.Clear();
            txtGhi_Chu.Document.Blocks.Clear();
            chbTheo_Toa.IsChecked = false;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ma_hc = hoatchatctrl.loadID_moi();

        }
    }
}
